<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="css/bootstrap.css" />
</head>
<body>
<table class="table table-striped table-bordered table-hover">

	<tr><td align="center" colspan="9">
					<ul class="pagination ">

		<li><a href="demo.do?page=1">首页</a></li>
		<!--判断是否有上一页 -->
		<c:if test="${npage-1>0 }">
			<li><a href="demo.do?page=${npage-1 }">&laquo;</a></li>
		</c:if>

		<!--循环显示页数 -->
		<c:forEach var="p" begin="${npage-3>0?(npage-3):1 }"
			end="${npage+3<total?(npage+3):total }" step="1">
			<!--判断是否是当前页 ,让当前页为另一种颜色-->
			<c:if test="${npage==p }">
				<li class="active"><a href="demo.do?page=${p }">${p }</a></li>
			</c:if>
			<c:if test="${npage!=p }">
				<li><a href="demo.do?page=${p }">${p }</a></li>
			</c:if>
		</c:forEach>

		<!--判断是否有下一页 -->
		<c:if test="${npage<total }">
			<li><a href="demo.do?page=${npage+1 }">&raquo;</a></li>
		</c:if>

		<!--末页 -->
		<li><a href="demo.do?page=${total}">末页</a></li>
	</ul>

		</td></tr>
		<tr class="danger">
			<td>用户编号</td>
			<td>用户名</td>
			<td>用户密码</td>
			<td>电子邮箱</td>
			<td>用户性别</td>
			<td>用户地址</td>
			<td>兴趣爱好</td>
			<td>添加时间</td>
			<td>操作</td>
		</tr>

		<c:forEach var="u" items="${list}">
			<tr class="success">
				<td class="active">${u.user_id }</td>
				<td class="success">${u.user_nickname}</td>
				<td class="warning">${u.user_password }</td>
				<td class="danger">${u.user_email }</td>
				<td class="success">${u.user_sex}</td>
				<td class="danger">${u.user_address}</td>
				<td class="active">${u.user_hobby }</td>
				<td class="warning">${u.user_addtime}</td>
				<td><a class="btn btn-success" href="add.jsp">添加</</a> <a
					class="btn btn-danger" href="delete.do?id=${u.user_id }">删除</</a> <a
					class="btn btn-primary" href="toUpdate.do?id=${u.user_id }">修改</</a>&nbsp;
				</td>
			</tr>
		</c:forEach>
		
	</table>

</body>
</html>